<%@ page contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs-popup.jsp" %>
<script type="text/javascript">
function edit(id) {
	  Geni.Popup.showWindow({
	      url: "<g:url namespace='/account' action='preEditRole' includeParams='none'/>?id=" + id,
	      title: "修改角色",
	      width: 600,
	      height: 800,
	      returnCallback: function(data) {
	    	window.location.reload();
	        if (data != null) {
	        }
	      }//$j('.id').val()
	  });
	}

function create() {
	  Geni.Popup.showWindow({
	      url: "<g:url namespace='/account' action='preCreateRole' includeParams='none'/>",
	      title: "新增角色",
	      width: 600,
	      height: 800,
	      returnCallback: function(data) {
	     	// var dispatchUrl = "<g:url namespace='/module/order' action='ListSoSplited' includeParams='none' />";
	    	// window.parent.location = dispatchUrl ;
	    	window.location.reload();
	        if (data != null) {
	        }
	      }//$j('.id').val()
	  });
	}

function assignMenuResource(id) {
	  Geni.Popup.showWindow({
	      url: "<g:url namespace='/account' action='preAssignMenuAndResource2Role' includeParams='none'/>?id=" + id,
	      title: "分配菜单和资源",
	      width: 800,
	      height: 500,
	      returnCallback: function(data) {
	    	window.location.reload();
	        if (data != null) {
	        }
	      }//$j('.id').val()
	  });
	}
</script>
<g:panel>
	<div class="currentPosition">
		<g:property value="%{getText('current.position')}"></g:property>
		<g:property value="%{getText('role.list')}"></g:property>
	</div>
</g:panel>
<g:toolbar>
	<g:button type="submit" key="role.create" cssClass="button" onclick="create();"/>
</g:toolbar>
<g:form namespace="/account" method="post" id="soForm">
  <g:panel key="role.list">
	<display:table class="dataTable" name="pageList" list="fullList" export="false" sort="external" 
        id="row" requestURI="listRole.action" decorator="org.ttitfly.ttcore.displaytag.ItemLineDecorator">
      <c:set value="${row}" scope="request" var="row" />
      <display:column
			title="<input type='checkbox' id='selectAll' onclick='selectA()'/>"
			style="width:3%;">
			<g:if test="#request.row.pod != true">
				<input type="checkbox" name="checkboxList" value="${row.id}" />
			</g:if>
			
		</display:column>
  	
      <display:column property="name" titleKey="label.title" sortable="true"  headerClass="sortable" style="width:20%;"/>
      <display:column titleKey="basicOperation" style="width:10%">
          <g:actionbar>
            <g:actionurl href="#" onclick="edit(\"%{#request.row.id}\")" title="%{getText('edit')}" status="true" imageSrc="%{imgBasePath}/common/edit.gif"/>
       		<g:actionurl href="deleteRole.action?Id=%{#request.row.id}" status="true" imageSrc="%{imgBasePath}/common/delete.gif" title="%{getText('delete')}"/>
          </g:actionbar>
      </display:column>
     <display:column titleKey="operation" style="width:5%">
         <g:actionbar>    
       		<g:actionurl href="#" onclick="assignMenuResource(\"%{#request.row.id}\")" title="%{getText('assign.menu.resource')}" status="true" imageSrc="%{imgBasePath}/add.gif"/>
       </g:actionbar>
     </display:column>
   
    </display:table>
  </g:panel>
</g:form>